FeedbackManager = null;

_FeedbackManager = function(){
	this.Message = null;
	this.From = null;
	this.Page = null;
	this.FormIsOpened = false;
}
_FeedbackManager.prototype = {
	SetVisibility: function(vState)
	{
		this.FormIsOpened = vState;
		if(vState)
		{
			$("#feedbackForm").show();
		}else{
			$("#feedbackForm").hide();
		}
	},
	Send: function()
	{
		this.Message = $("#feedbackInput").val();
		this.From = $("#feedbackFrom").val();
		this.Page = NavigationManager.GetCurrentTarget();
		var _AddFeedback = ClientCommandsManager.Get("AddFeedBack");
		_AddFeedback.Page = this.Page;
		_AddFeedback.From = this.From;
		_AddFeedback.Message = this.Message;
	    ClientCommandsManager.Execute(_AddFeedback, this.SuccessHandler, null);
		this.CloseForm();
	},
	SuccessHandler: function(data, status, request) {
		if(data){
			var nItem = NotificationManager.CreateNotification("Feedback has been added", ["ok"]);
    		NotificationManager.ShowMessages([nItem]);
		}
    },
	OpenForm: function()
	{
		if(!this.FormIsOpened)
		{
			CloakManager.OnCloak(false,false);
			this.SetVisibility(true);
		}
	},
	ClearForm: function()
	{
		$("#feedbackInput").val("");
		$("#feedbackFrom").val("");
	},
	CloseForm: function()
	{
		this.SetVisibility(false);
		this.ClearForm();
		CloakManager.OffCloak(false,false);
	}
}